﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pay.Data {
   
    public partial class TokenTransferMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<TokenTransfer> {
        public TokenTransferMap() {
            // table
            ToTable("mc_TokenTransfer", "dbo");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.MerchantId)
                .HasColumnName("MerchantId")
                .IsRequired();
            Property(t => t.TransferAmount)
                .HasColumnName("TransferAmount")
                .HasPrecision(18, 6)
                .IsRequired();
            Property(t => t.Amount)
                .HasColumnName("Amount")
                .HasPrecision(18, 6)
                .IsRequired();
          
            Property(t => t.SettleAmount)
                .HasColumnName("SettleAmount")
                .HasPrecision(18, 6)
                .IsRequired();
            Property(t => t.SettleRate)
             .HasColumnName("SettleRate")
             .HasPrecision(18, 6)
             .IsRequired();

            // Relationships
            HasRequired(t => t.Merchant)
                .WithMany()
                .HasForeignKey(d => d.MerchantId)
                .WillCascadeOnDelete(false);
            HasOptional(t => t.AuditManage)
                .WithMany()
                .HasForeignKey(d => d.AuditManageId)
                .WillCascadeOnDelete(false);
            HasOptional(t => t.PayManage)
                .WithMany()
                .HasForeignKey(d => d.PayManageId)
                .WillCascadeOnDelete(false);
            HasOptional(t => t.PayInfo)
                .WithMany()
                .HasForeignKey(d => d.PayId)
                .WillCascadeOnDelete(false);
        }
    }
}
